﻿@{
    Layout = "~/Views/Shared/_VueLayout.cshtml";

}
<link href="/css/scrollBar.css" rel="stylesheet" />
<div style="width: 100%; height: 101%;" id="app">
    <el-row>
        <el-col :span="6">
            <el-upload class="upload-demo"
                       style="width:100%;overflow-x:auto"
                       drag
                       action="/Tool/AddFile"
                       multiple>
                <i class="el-icon-upload"></i>
                <div style="" class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
                <div class="el-upload__tip" slot="tip">文件不超过1G</div>
            </el-upload>
        </el-col>
        <el-col :span="18">
            <div style="width: 98%; height: 800px; border: 1px solid #CCCCCC">
                <div>
                    <textarea id="oldTextarea" style="width: 88%; height: 93px" v-model="str"></textarea>
                    <el-button slot="append" style="width: 11%; height: 100px; float: right" @@click="AddShareContent" type="primary">分享</el-button>
                </div>
                <el-divider><i class="el-icon-mobile-phone"></i></el-divider>
                <div style="width: 98%; height: 620px; overflow-y: auto">
                    <el-timeline :reverse="true">
                        <el-timeline-item v-for="(item, index) in data"
                                          placement="top"
                                          :key="index"
                                          :timestamp="item.createTime">
                            <a :href="item.url" v-if="item.type">{{item.content}}</a>
                          @*  {{item.content}}*@
                        </el-timeline-item>
                    </el-timeline>
                </div>
            </div>
        </el-col>
    </el-row>
</div>
<script src="~/axios/axios.js"></script>
<script>
    var vueApp = undefined;
    var vm = new Vue({
        el: '#app',
        data: function () {
            vueApp = this;
            return {
                str:"",
                data: [],
                fileList: []
            };
        },
        filters: {

        },
        created() {
            this.GetShareContent();
        },
        methods: {
            AddShareContent() {
                axios.post('/Tool/AddShareContent',
                    {
                        content:vueApp.str,
                    }).then(function (response) {
                    if (response.data.success) {
                        vueApp.GetShareContent();
                        vueApp.$message({
                            message: '分享成功',
                            type: 'success'
                        });
                    }
                    vueApp.visitorLog = response.data.data;
                }).catch(function (error) {
                    vueApp.$message.error('分享失败');
                });
            },
            GetShareContent() {
                axios.post('/Tool/GetShareContent',
                    {
                        shareCode:"",
                    }).then(function (response) {
                    vueApp.data= response.data.data;
                    console.log(vueApp.data);
                    vueApp.visitorLog = response.data.data;
                }).catch(function (error) {
                    this.$message.error('查询失败');
                });
            },
        }
    });
</script>